package club.caihappy.config;

import club.caihappy.Condition.*;
import club.caihappy.pojo.Color;
import club.caihappy.pojo.Person;
import org.springframework.context.annotation.*;

/**
 * Created by DELL on 2021/10/4
 **/
@Configuration
@Import({Color.class, MyImportSelector.class, MyImportBeanDefinitionRegistrar.class})
public class MainConfig2 {
    @Scope("prototype")
    @Bean("person")
    public Person person() {
        return new Person("张三", 25);
    }

    @Conditional(WindowsCondition.class)
    @Bean("bill")
    public Person person1() {
        return new Person("Bill Gates", 66);
    }

    @Conditional(LinuxCondition.class)
    @Bean("linus")
    public Person person2() {
        return new Person("linus", 44);
    }

    @Bean
    public ColorFactoryBean getColorFactoryBean() {
        return new ColorFactoryBean();
    }
}
